package com.example.stub.simulator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.example.manager.ManagerClient;
import com.example.stub.SimulatorException;
import com.example.stub.SimulatorThread;
import com.example.util.DataBuilder;
import com.example.util.DeviceFactory;

public class ManagerRegisterThread extends SimulatorThread {

	private final static Logger log = LoggerFactory.getLogger(ManagerRegisterThread.class);
	
	public ManagerRegisterThread(int no, int totalThread) throws Exception {
		super(no, totalThread);
	}

	@Override
	public void execute() throws SimulatorException {
		try{
			String macid = DataBuilder.buildRandomMacAddress();
			ManagerClient client = new ManagerClient(macid);
			
			client.start();
			
			String phone = DeviceFactory.createPhoneNumber();
			client.register(phone, phone, phone + "@test.com");
			
		}catch(Exception e){
			throw new SimulatorException(super.no, e);
		}
	}

}
